<template>
  <div ref="container" class="container"></div>
</template>

<script setup lang="ts">

import { onMounted, onUnmounted, getCurrentInstance } from 'vue'

import { TestScene } from '../scene/TestScene'

let scene:TestScene|null = null;

onMounted(() => {

  const container = getCurrentInstance()?.refs['container'];
  // 场景的容器
  
  scene = new TestScene();
  
  scene.init(container);
  
})


onUnmounted(() => {
  if (scene) {
    scene.clear();
  }
});

</script>

<style scoped>
.container {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
</style>